﻿using System;
using System.Globalization;
using System.IO.IsolatedStorage;
using FreshMeat.Storage;
#if SILVERLIGHT && WINDOWS_PHONE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
#else
using Microsoft.VisualStudio.TestTools.UnitTesting;
#endif

namespace Storage.More.Test
{
   [TestClass]
   public class IsolatedStorageFileSystemTest : CommonFileSystemTest
   {
      protected override IFileSystem CreateSystem()
      {
#if SILVERLIGHT
         var area = IsolatedStorageFile.GetUserStoreForApplication();
#else
         var area = IsolatedStorageFile.GetUserStoreForAssembly();
#endif
         string folder;
         do
         {
            folder = DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture);
         } while (area.DirectoryExists(folder));
         area.CreateDirectory(folder);

         return new IsolatedStorageFileSystem(area, folder);
      }

      [TestMethod]
      public void Abc()
      {
         Assert.Fail();
      }
   }

   [TestClass]
   public class IsolatedStorageFileSystemAsyncTest : CommonFileSystemAsyncTest
   {
      protected override IFileSystem CreateSystem()
      {
#if SILVERLIGHT
         var area = IsolatedStorageFile.GetUserStoreForApplication();
#else
         var area = IsolatedStorageFile.GetUserStoreForAssembly();
#endif
         var folder = DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture);
         area.CreateDirectory(folder);

         return new IsolatedStorageFileSystem(area, folder);
      }
   }
}